using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class databasesListMap : EntityTypeConfiguration<databasesList>
    {
        public databasesListMap()
        {
            // Primary Key
            this.HasKey(t => new { t.dbName, t.dbid, t.FileName });

            // Properties
            this.Property(t => t.dbName)
                .IsRequired()
                .HasMaxLength(128);

            this.Property(t => t.dbid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FileName)
                .IsRequired()
                .HasMaxLength(260);

            // Table & Column Mappings
            this.ToTable("databasesList");
            this.Property(t => t.dbName).HasColumnName("dbName");
            this.Property(t => t.dbid).HasColumnName("dbid");
            this.Property(t => t.FileName).HasColumnName("FileName");
        }
    }
}
